<?php
header('P3P: CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"');//p3p
header('Access-Control-Allow-Origin:*');
session_start();
$_SESSION['XDEBUG_SESSION_START'] =isset($_POST['XDEBUG_SESSION_START'])?$_POST['XDEBUG_SESSION_START']:$_SESSION['XDEBUG_SESSION_START'];
?><!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width-device-width,initial-scale=1" />
  <title>调试观察</title>
  <script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
  <style>
    textarea{width:100%;height:200px}
    .arow{clear:both;width:700px;height:50px}
    .arow textarea{width:90%;height:45px}
    .arow div{float:left;}
    .arow .tdh{width:150px}
    .arow .tdv{width:500px;overflow:hidden}
    textarea{width:100%;;height:100px;font-size:11px}

  </style>
  <script type="text/javascript">
    function xonc() {
      var nr = $("#nr").val();
      $("#XDEBUG_SESSION_START_id").val($("#XDEBUG_SESSION_START").val());
      if (/^(http\:\/\/[^\r\n]*)$/gi.test(nr)) {
        nr = nr.replace(/&XDEBUG_SESSION_START=[0-9]*/gi, "") + "&XDEBUG_SESSION_START=" + $("#XDEBUG_SESSION_START").val();
      }else{
        nr = nr.replace(/&XDEBUG_SESSION_START=[0-9]*/gi, "").replace(/((?:POST|GET)\s+[^\r\n\s]+)(\s+http\/)/gi, "$1" + "&XDEBUG_SESSION_START=" + $("#XDEBUG_SESSION_START").val() + "$2");
      }
      $("#biaodan").attr("action", $("#biaodan").attr("action").replace(/&XDEBUG_SESSION_START=[0-9]*/gi, "") + "&XDEBUG_SESSION_START=" + $("#XDEBUG_SESSION_START").val());
      $("#theurl").attr("href", $("#theurl").attr("href").replace(/&XDEBUG_SESSION_START=[0-9]*/gi, "") + "&XDEBUG_SESSION_START=" + $("#XDEBUG_SESSION_START").val());
      $("#theurl").html($("#theurl").attr("href"));
      $("#nr").val(nr);
    }

    function jj(){
       $.post("http://collect1.longsunhd.com/jsondecode.php",{"data":$("#changejson").val()},function(data){
           debugger;
         changejson.value=data;
      });
    }

    function setcookie(){
        debugger;
        var s=$("#nr").val();
        var host = /host\:\s*([^\s]*)/gi.exec(s)[1];
        var cookiestr= /cookie\:\s*([^\r\n]*)/gi.exec(s)[1];
        guanchachuangifr.location="http://"+host+"/setcookie.php?cookiestr="+cookiestr;
        myform.submit();
    }
  </script>
</head>
<?php
if($_REQUEST['B1']) {
    setcookie("xxx", "aaa", time()+1*24*60*60, "/", "laigao.longsunhd.com");
}
$nr=$_POST['nr'];
if($nr==""&&$_GET['B1']==""||$_POST['reload']) {
  $fn = fopen("d:/TMPTMP_ytempnr.htm", "r");
  $nr = fread($fn, filesize("d:/TMPTMP_ytempnr.htm"));
  fclose($fn);
  $ispost = 0;
}
?>
<pre>
<?php
  if($_POST['XDEBUG_SESSION_START']!="") {
      $nr = preg_replace_callback("/((?:POST|GET)\s+(?:[^\s]+?))(\s*http\/)/Uisx", function ($em) use ($_POST) {
        return preg_replace("/&XDEBUG_SESSION_START=\s*[0-9]*/", "", $em[1]) . "&XDEBUG_SESSION_START=" . trim($_POST[XDEBUG_SESSION_START]) . $em[2];
      }, $nr);
  }
  if(preg_match("/(POST|GET)\s+([^\s]+)\s*http\//i",trim($nr),$nnpp)) {
    $method = $nnpp[1];
    $suburl = $nnpp[2];
    preg_match("/Host\:\s*([^\s]+)/isx", $nr, $nn);
    $host = $nn[1];
    if(preg_match("/^http\:\/\//Uisx",$suburl)){
      $url = $suburl;
    }else{
      $url = "http://" . $nn[1] . $suburl;
    }
    $ispost = 1;
    preg_match("/(?:\r|\n)+([a-zA-Z_0-9]+\=[a-z_0-9]*[^\s]*)\s*$/is", $nr, $nn);
    $postdata = $nn[1];
    preg_match_all("/\b([^\s\=&]+)\=([^\s\=&]*)/isx", $postdata, $nn);
    $length = strlen($postdata);
    $nr = preg_replace("/Content-Length\:\s*([0-9]+)/", "Content-Length: {$length}", $nr);
  }elseif(preg_match("/^(http\:\/\/[^\r\n]*)$/",$nr,$nnone)||$_GET[post]==1) {
      $method = "GET";
      $url = $nnone[1];
      $ispost = 1;
  }elseif(preg_match_all("/([^\s\=&\?]+)\=([^\s\=&]*?)/Uimx", $nr, $nn)){
      preg_match("/^(http\:\/\/[^\r\n]*?)(.*)$/Uisx",$nr,$nn);
      $url=$nn[1];
      preg_match_all("/([^\s\=&\?]+)\=([^\s\=&]*?)/Uimx", $nn[2], $nn);
      if(count($nn[1])>1){
          $method="POST";
      }else{
          $method="GET";
      }
      $ispost=1;

  }

?>
</pre>
<?php
if($ispost){
?>
<form name=myform id=myform target="_self" method="POST" action="readytempnr.php">
<textarea name="nr" id="nr"><?php echo $nr?></textarea>
<input type="hidden" name="XDEBUG_SESSION_START" id="XDEBUG_SESSION_START_id" value="<?php echo $_SESSION['XDEBUG_SESSION_START']?>">
<br><input type="submit" name="reload" value="reload">
    <input type="button" name="B1" value="修改" onclick="setcookie()">
</form>

<form id="biaodan" method="<?php echo $method?>" action="<?php echo $url?>" target="guanchachuangifr">
    <div id="tj">
        <br><?php echo $method?>:<?php echo $url?>
        <br>XDEBUG_SESSION_START:<input value="<?php echo $_SESSION['XDEBUG_SESSION_START']?>" name="XDEBUG_SESSION_START" id="XDEBUG_SESSION_START" onblur="xonc()">
        <br><a style="font-size:11px" target=_blank href="<?php echo $url;?>" id="theurl"><?php echo $url;?></a>
       &nbsp;<a style="font-size:11px" target=_blank href="file:///D:/TMPTMP_ytempnr.htm">file:///D:/TMPTMP_ytempnr.htm</a>
    </div>
  <?php for($i=0;$i<count($nn[1]);$i++){?>
   <div class="arow">
     <div class="tdh"><?php echo $nn[1][$i];?></div>
     <div class="tdv"><textarea name="<?php echo $nn[1][$i];?>"><?php echo urldecode($nn[2][$i]);?></textarea></div>
   </div>
  <?}?>
    <div><input type="submit" name="B2" value="GET"> <input type="submit" name="B3" value="POST"></div>
</form>
<iframe id="guanchachuangifr" name="guanchachuangifr" border="1" style="width:100%;height:500px"></iframe>
<input type="submit" name="GET" value="JSON_Decode" onclick="jj()">
<textarea name="changejson"  id="changejson"  style="width:100%;height:500px"><?php echo urldecode($nn[2][$i]);?></textarea>

<?}?>
<div style="clear: both">
if("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"=="http://nn.ilaoyou.com/") {<br>
print_r($_SESSION);<br>
exit;<br>
}<br>
C:\Users\Yangzs\Desktop\清除php程序.bat<br>
C:\Users\Administrator\Desktop\清除php程序.bat<br>
file:///D:/TMPTMP_ytempnr.htm<br>
$GLOBALS["buginfo"]["sql"]=M()->getLastSql();<br>
r($GLOBALS["buginfo"]->lastsql);<br>
$GLOBALS[buginfo][tmplCacheFile]=$_SERVER[DOCUMENT_ROOT]."/".$tmplCacheFile;<br>
r2("http://".$_SERVER[HTTP_HOST].preg_replace("/\/\.\//","/",str_replace($_SERVER[DOCUMENT_ROOT],"",$GLOBALS[buginfo][tmplCacheFile])));<br>
$GLOBALS["buginfo"]["post"]=curl_getinfo($ch, CURLINFO_HEADER_OUT)."".http_build_query($post_data)."\r\n\r\n";<br>
找模板要搜 \$this\->compile_dir|\$tmplCacheFile
龙抓手要搜 getTempnr,getnr,clre,includetemp,evalpublic,deletePublic,autozq,getFlv,getPageContent
  getpostinfo();
</div>
